import request from "../utils/request";

// 歌曲管理接口----------------------------------

// 获取歌曲列表
export const fetchSonglistData = (data) => {
  return request({
    url: "/web/song/getList",
    method: "POST",
    data: data,
  });
};

// 获取版权方下拉框
export const fetchGetCopyrightOwnerSelect = (params) => {
  return request({
    url: "/sys/dictionary/getCopyrightOwnerSelect",
    method: "get",
    params: params,
  });
};

// 创建/修改歌曲
export const fetchSongCreate = (data) => {
  return request({
    url: "/web/song/create",
    method: "post",
    data: data,
  });
};

// 删除歌曲
export const fetchDeleteSong = (data) => {
  return request({
    url: "/web/song/deleteById",
    method: "post",
    data: data,
  });
};

// 上架歌曲
export const fetchSoldInSong = (data) => {
  return request({
    url: "/web/song/soldInSong",
    method: "post",
    data: data,
  });
};

// 下架歌曲
export const fetchSoldOutSong = (data) => {
  return request({
    url: "/web/song/soldOutSong",
    method: "post",
    data: data,
  });
};

// 通过key来获取歌曲路径
export const fetchGetObsUrl = (params) => {
  return request({
    url: "/web/file/getObsUrl",
    method: "get",
    params: params,
  });
};

// 获取子版本/分轨文件列表
export const fetchSongTrackFileList = (data) => {
  return request({
    url: "/web/songTrackFile/getList",
    method: "post",
    data: data,
  });
};

// 创建/修改分轨文件
export const fetchSongTrackFileCreate = (data) => {
  return request({
    url: "/web/songTrackFile/create",
    method: "post",
    data: data,
  });
};

// 删除分轨文件
export const fetchSongTrackFileDelete = (data) => {
  return request({
    url: "/web/songTrackFile/deleteById",
    method: "post",
    data: data,
  });
};

// 下载模版
export const fetchDownloadTemplate = (params) => {
  return request({
    url: "/web/song/excelDownloadTemplate",
    method: "get",
    params: params,
  });
};

// 通过excel上传歌曲
export const fetchExcelUploadSong = (data) => {
  return request({
    url: "/web/song/excelUploadSong",
    method: "post",
    data: data,
  });
};

// 下载歌曲
// export const fetchDownloadSong = (data) => {
//   return request({
//     url: "/web/song/downloadSong",
//     method: "post",
//     data: data,
//   });
// };
// 管理端下载歌曲，不判断权限
export const fetchDownloadSong = (data) => {
  return request({
    url: "/web/song/manager/downloadSong",
    method: "post",
    data: data,
  });
};

// 收藏歌曲到歌单
export const fetchCollectionSong = (data) => {
  return request({
    url: "/web/song/collectionSong",
    method: "post",
    data: data,
  });
};

// 从歌单里---取消收藏歌曲
export const fetchCancelCollectionSong = (data) => {
  return request({
    url: "/web/song/cancelCollectionSong",
    method: "post",
    data: data,
  });
};

// 设置歌曲为推荐
export const fetchSetRecommended = (params) => {
  return request({
    url: "/web/song/setRecommended",
    method: "get",
    params: params,
  });
};

// 歌曲移除推荐
export const fetchDeleteRecommended = (params) => {
  return request({
    url: "/web/song/deleteRecommended",
    method: "get",
    params: params,
  });
};

// 导出歌曲excel，返回excel的url地址
export const fetchExcelDownloadSong = (data) => {
  return request({
    url: "/web/song/excelDownloadSong",
    method: "post",
    data: data,
  });
};

// 下载excel批量给歌曲打标签模板

export const fetchUpdateTagTemplate = (params) => {
  return request({
    url: "/web/song/excelUpdateTagTemplate",
    method: "get",
    params: params,
  });
};
